package com.googlecode.wheres_my_stuff_okay_potato;

import java.util.List;

import junit.framework.Assert;

/**
 * This utility class runs JUnit tests on Global.addFoundItem().
 * 
 * @author Chad Miller
 */
public class ChadJUnitTests {
	private final User USER = new User("Chad", "password",
			"cmiller86@gatech.edu");
	private final FoundItem[] ITEMS = {
			new FoundItem("Test1", "Test1", "Test1", USER, "Other"),
			new FoundItem("Test2", "Test2", "Test2", USER, "Other"),
			new FoundItem("Test3", "Test3", "Test3", USER, "Other"),
			new FoundItem("Test4", "Test4", "Test4", USER, "Other"),
			new FoundItem("Test5", "Test5", "Test5", USER, "Other"),
			new FoundItem("Test6", "Test6", "Test6", USER, "Other"),
			new FoundItem("Test7", "Test7", "Test7", USER, "Other"),
			new FoundItem("Test8", "Test8", "Test8", USER, "Other"),
			new FoundItem("Test9", "Test9", "Test9", USER, "Other"), };
	private Global global = new Global();
	private boolean alreadyAddedItems = false;

	private void addFoundItems() {
		for (FoundItem i : ITEMS)
			global.addFoundItem(i);

		alreadyAddedItems = true;
	}

	public void testAddFoundItem1() {
		if (!alreadyAddedItems)
			addFoundItems();

		List<Item> foundItems = global.getFoundItems();

		for (FoundItem i : ITEMS)
			Assert.assertTrue(foundItems.contains(i));
	}

	public void testAddFoundItem2() {
		if (!alreadyAddedItems)
			addFoundItems();

		List<Item> foundItems = global.getCurrentUserItems();

		for (FoundItem i : ITEMS)
			Assert.assertTrue(foundItems.contains(i));
	}
}